/*
 *      net-sim - networkProtocols
 *
 * 		NetworkProtocols.java
 *
 *      Copyright 23/12/2008 nicolas
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 3 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
package networkProtocols;

import java.util.HashMap;
import java.util.Map;

/**
 * The Class NetworkProtocols.
 */
public class NetworkProtocols {

  // Tipos de protocolo soportados por el data link
  /** The Constant PROTO_IP. */
  public static final int PROTO_IP = 1;

  /** The Constant PROTO_ARP. */
  public static final int PROTO_ARP = 2;

  /** The Constant PROTO_ICMP. */
  public static final int PROTO_ICMP = 3;

  /** Tabla con los protocolos de N3 registrados. */
  public static Map<Integer, Object> protocols = null;

  /**
   * Instantiates a new network protocols.
   */
  public NetworkProtocols(){
    protocols = new HashMap<Integer, Object>();
  }

  /**
   * Agrega un protocolo de nivel 3 o que opera en ese nivel (IP, ICMP, ARP). Deberia chequearse.
   *
   * @param num the num
   * @param prot the prot
   */
  public static void addProtocol(Integer num, Object prot) {
    protocols.put(num, prot);
  }

  /**
   * Dado un numero de protocolo, devuelve su referencia.
   *
   * @param num the num
   *
   * @return the protocol
   */
  public static Object getProtocol(Integer num) {return (Object) protocols.get(num);}

/*
  public String toString() {
    Set<String> keySet = ifaces.keySet();
    for (String elementKey : keySet) {
      Interface i = ifaces.get(elementKey);
      System.out.println("Iface: "+ i.toString());
    }
    return "eee";
  }
*/
}



